<form action="/param/saveOrUpdate" method="post" class="form-inline" style="margin: 0 auto;"
	class="text-center" data-toggle="validate" data-alertmsg="false"
	data-callback="dialogCallback">

		<div class="col-sm-12 "
			style="padding-right: 0; padding-left: 2px; padding-bottom:2px; height: 100%; width:100%; padding-top: 1px; border-bottom: 2px solid #dfdfe2">
      
        <input type="hidden" name="param.id" id="id" value="${param.id!}">
       <div class="from-control" style="padding:10px;">
         <span  style="padding-bottom: 10px;">
			<lable class="x150"> 参数名称:</lable>
			<input type="text" name="param.name" value="${param.name!}"
				data-rule="required"  class="form-control ">
		</span>
		<span  style="padding-bottom: 10px;">
			<lable class="x85">参数编码:</lable>
			<input type="text" name="param.code" value="${param.code!}"
				  class="form-control">
		</span>
		<span  style="padding-bottom: 10px;">
			<input type="radio" name="param.status" value="1" ${param.status!}==1?checked:''   data-toggle="icheck" data-label="启用">
            <input type="radio" name="param.status" value="0" ${param.status!}==0?checked:'' data-toggle="icheck" data-label="停用">
		</span>
      </div>
  

         <div class="from-control" style="padding-top:10px;">
       
          
</div>
		</div>
		<div class="col-sm-12 "
			style="padding-right: 0; padding-left: 2px; height: 500px;overflow:auto;">
			
			 <table id="param_table" class="table table-bordered table-hover table-striped table-condensed table-top" data-toggle="tabledit"  data-action="/paramValue/save/${param.id!}" data-single-noindex="true">
            <thead>
            
                <tr data-idname="paramValue[#index#].id">
                    <th title="参数名称"><input type="text" name="paramValue[#index#].name"  data-rule="required"  size="5"></th>
                    <th title="参数代码"><input type="text" name="paramValue[#index#].code" data-rule="required" value="Da" size="5"></th>
                    <th title="参数值"><input type="text" name="paramValue[#index#].value" data-rule="required" value="熊大" size="5"></th>
                    <th title="排序号"><input type="text" name="paramValue[#index#].sort" data-rule="required" value="Xiong" size="5"></th>
                    <th title="参数状态"><select name="paramValue[#index#].status" data-toggle="selectpicker" data-rule="required"><option value="1">启用</option><option value="0">停用</option></select></th>
                    <th title="备注"><textarea name="paramValue[#index#].remark" data-toggle="autoheight" size="5"></textarea></th>
                   
                    <th title="" data-addtool="true" size="1000" >
                        <a  onclick="" class="btn btn-green" data-text="保存" data-toggle="dosave">保存</a>
                        <a  onclick="" class="btn btn-green" data-text="保存" data-toggle="dodel">删除</a>
                      <!--    <a href="ajaxDone2.html" class="btn btn-red row-del" data-confirm-msg="确定要删除该行信息吗？">删</a>
                        <a href="ajaxDone2.html" class="btn btn-red row-del" data-confirm-msg="确定要删除该行信息吗？">启用/停用</a>
                        -->
                    </th>
                </tr>
            </thead>
            <tbody>
            <!--:for(pv in paramValueList) { -->
            <form name="ttt">
                <tr data-id="${pv.id!}">
                    <td>${pv.name!}</td>
                    <td>${pv.code!}</td>
                    <td>${pv.value!}</td>
                    <td>${pv.sort!}</td>
                    <td id="status_${pv.id}" data-val="${pv.status}"></td>
                    <td>${pv.remark!}</td>
                    <td data-noedit="true">
                        <button type="button" class="btn-green" data-toggle="doedit">编辑</button>
                        <a href="/paramValue/delete/${pv.id}" class="btn btn-red row-del" data-confirm-msg="确定要删除该行信息吗？">删除</a>
                        <a class="btn btn-red" onclick="startOrStop(${pv.id},${pv.status})">
                       <!--: if(pv.status=="1"){ --> 停用
                       <!--:}else {  -->
                       启用
                       <!--:}  -->
                       </a>
                    </td>
                </tr>
                <!--:}  -->
               
              </form>
            </tbody>
        </table>
	</div>
</form>

<script>
function startOrStop(id,status){
	var data='id:'+id+',status:'+status;
	var obj=new Object();
	obj.id=id;
	obj.status=status;
	var callback='updateRecord';
//	ces.ajaxLoad('/paramValue/updateStatus',data
//			,callback);
     var url='/paramValue/updateStatus';
	$.ajax({
		type : "post",
		url : encodeURI(encodeURI(ctxPath + url)),
		data :obj ,
		dataType : "json",
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",
		async: false,
		cache: false,
		success:function(json){
			if(callback)
			{  return updateRecord(json);}
			else if(json.statusCode==BJUI.statusCode.ok){
			$(window).alertmsg("ok", data.id)
				
			}else if(json.statusCode==BJUI.statusCode.error){
				$(window).alertmsg("error", data.id)
			}else if(json.statusCode==BJUI.statusCode.timeout)
			{
				$(window).alertmsg("timeout","请求超时")
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) { 
			
			alert(errorThrown);
        }
        
	});
}
function updateRecord(json){
	if(json.statusCode == BJUI.statusCode.ok) {
		 $(window)
         .alertmsg('info', json.message,{autoClose:'true'})
		$('#param_main').bjuiajax('doLoad', {
			url : '/param/show',
			data : {
				id : $("#id").val()
			},
			target : '#param_main'
		})
	    } else {
	        $(window)
	            .alertmsg('info', json.message,{autoClose:'true'})
	    
	}
	
}
</script>